@model AdminIndexViewModel

<h1>@RenderTitleSegments(T["Indexes"])</h1>

<nav class="admin-toolbar">
    <ul class="navbar-nav mr-auto"></ul>
    <ul class="navbar-nav">
        <li class="nav-item">
            <a asp-route-action="Create" class="btn btn-primary" role="button">@T["Add Index"]</a>
        </li>
    </ul>
</nav>

<form asp-action="Index">
    @* the form is nessecary to generate and antiforgery token for the delete action *@
    @if (Model.Indexes.Any())
    {
        <ul class="list-group">
            @foreach (var entry in Model.Indexes)
            {
                <li class="list-group-item">
                    <div class="properties">
                        <div class="related">
                            <a asp-action="Query" asp-route-IndexName="@entry.Name" class="btn btn-success btn-sm">@T["Query"]</a>
                            <a asp-action="Reset" asp-route-id="@entry.Name" class="btn btn-primary btn-sm" data-message="@T["This will restart the indexing of all content items. Continue?"]" itemprop="UnsafeUrl">@T["Reset"]</a>
                            <a asp-action="Rebuild" asp-route-id="@entry.Name" class="btn btn-warning btn-sm" data-message="@T["Your index will be rebuilt, which might alter some services during the process. Continue?"]" itemprop="UnsafeUrl">@T["Rebuild"]</a>
                            <a asp-action="Delete" asp-route-IndexName="@entry.Name" class="btn btn-danger btn-sm" itemprop="RemoveUrl UnsafeUrl">@T["Delete"]</a>
                        </div>
                        <h5>@entry.Name</h5>
                    </div>
                </li>
            }
        </ul>
    }
    else
    {
        <div class="alert alert-info" role="alert">
            @T["<strong>Nothing here!</strong> There are no indexes for the moment."]
        </div>
    }
</form>

